package com.scholarship.modules.admin.mapper;

import com.scholarship.modules.admin.dto.CommonPrizeDto;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * 各动态存储奖项表-a2,a3等
 * @Author Z.J.H
 * @create 2021/9/5 14:59
 */
@Repository
public interface ACommonMapper {

    /**
     * 保存指定学生id的指定奖项信息
     * @param tableName
     * @param map
     * @return
     */
    int insertAndUpdateSelectedReward(@Param("tableName") String tableName, @Param("map") Map<String,Object> map);

    /**
     * 批量插入奖项信息
     *
     * @param commonPrizeDto
     * @return
     * @throws Exception
     */
    int insertSelectedRewardList(@Param("common") CommonPrizeDto commonPrizeDto) throws Exception;

    /**
     * 批量插入或更新奖项信息
     *
     * @param commonPrizeDto
     * @return
     * @throws Exception
     */
    int insertAndUpdateSelectedRewardList(@Param("common") CommonPrizeDto commonPrizeDto) throws Exception;

    /**
     * 删除指定奖项信息
     *
     * @param tableName 奖项
     * @return
     * @throws Exception
     */
    int deleteAllSelectedReward(@Param("tableName") String tableName) throws Exception;

    /**
     * 删除指定学生id的指定奖项信息
     * @param tableName
     * @param useId
     * @return
     */
    int deleteSelectedRewardByUserId(@Param("tableName") String tableName, @Param("userId") String useId);

    /**
     * 通过学生id查询指定奖项信息
     * @param userId
     * @param commonPrizeDto
     * @return
     */
    Map<String,Object> getStudentReward(@Param("userId") String userId, @Param("common") CommonPrizeDto commonPrizeDto);

    /**
     * 获取指定奖项信息列表（Excel导出文件）
     * @param tableId
     * @return
     */
    List<Map<String,Object>> listStudentRewardExcel(@Param("tableId") Integer tableId, @Param("tableName") String tableName, @Param("fields") List<String> fields);
}
